f80e2de633e15ec1609e2700d6ebdfb898dc3be2,integrations/opennms-rancid/src/main/java/org/opennms/netmgt/provision/RancidProvisioningAdapter.java,RancidProvisioningAdapter,updateNode,#number#,145

Before Change


    public void updateNode(int nodeId) throws ProvisioningAdapterException {
        log().debug("RANCID PROVISIONING ADAPTER CALLED updateNode");
        try {
            String url = m_rwsConfig.getBaseUrl().getServer_url();
            OnmsNode node = m_nodeDao.get(nodeId);
            
            //FIXME: Gugliemo, I made this change... we're keeping a reference to the RancidNode object,
            //no need to look it up now via the API unless you think we still need to do this.
            //RancidNode r_node = RWSClientApi.getRWSRancidNode(url, m_rancidAdapterConfig.getGroup(), node.getLabel());
            RancidNode rNode = m_onmsNodeRancidNodeMap.get(Integer.valueOf(nodeId)).getNode();

            //FIXME: something looks weird with this if statement
            if (rNode.getDeviceName() != null ) {
                rNode = getSuitableRancidNode(node);
                RWSClientApi.updateRWSRancidNode(url, rNode);
            } else {
                rNode = getSuitableRancidNode(node);
                RWSClientApi.createRWSRancidNode(url, rNode);                
            }
            
            RancidNodeAuthentication rAuth = getSuitableRancidNodeAuthentication(node);

After Change


    public void updateNode(int nodeId) throws ProvisioningAdapterException {
        log().debug("RANCID PROVISIONING ADAPTER CALLED updateNode");
        try {
            OnmsNode node = m_nodeDao.get(nodeId);
            
            RancidNode rNode = getSuitableRancidNode(node);
            RWSClientApi.createOrUpdateRWSRancidNode(m_cp, rNode);
            
            RancidNodeAuthentication rAuth = getSuitableRancidNodeAuthentication(node);
            RWSClientApi.createOrUpdateRWSAuthNode(m_cp, getSuitableRancidNodeAuthentication(node));
            
            m_onmsNodeRancidNodeMap.replace(node.getId(), new RancidNodeContainer(rNode, rAuth));
        } catch (Exception e) {